<?
class ModPbnyWeeklyVideosHelper
{
    function getVideos(){
		
		JModel::addIncludePath(JPATH_BASE . DS . 'administrator' . DS . 'components' . DS . 'com_pbny' . DS . 'models');
		
		$video   = JModel::getInstance( 'video', 'videomodel' );
		$videos  = $video->get_video_gallery();
		
		return ModPbnyWeeklyVideosHelper::prepare_videos($videos);
	}
	
	private function prepare_videos($videos){
		
		$result = array();
		$mvideo  = JModel::getInstance( 'video', 'videomodel' );
		
		if($videos){
			foreach($videos as $video){
			
				$video->thumbnail     = $mvideo->get_video_thumbnail($video->video);
				$video->type_instance = $mvideo->get_video_type_instance($video->video_type, $video->id);
				$result[$video->id]   = $video;
				
			}
		}
		
		return $result;
	}
	
}
?>
